package com.hanlink.dsp.ui.adapter;

import android.content.Context;
import android.graphics.Color;
import androidx.annotation.NonNull;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;

import com.qztech.sdk.R;

/**
 * Created by zhb on 2017/8/8.
 */

public class FilterTypeAdapter extends ArrayAdapter<String> {

    public FilterTypeAdapter(@NonNull Context context, String[] stringArray) {
        super(context, android.R.layout.simple_spinner_item, stringArray);
    }

    @Override
    public View getDropDownView(int position, View convertView, @NonNull ViewGroup parent) {
        if (convertView == null) {
            LayoutInflater inflater = LayoutInflater.from(getContext());
            convertView = inflater.inflate(android.R.layout.simple_spinner_dropdown_item, parent, false);
        }
        TextView tv = convertView.findViewById(android.R.id.text1);
        tv.setText(getItem(position));
        tv.setBackgroundColor(getContext().getResources().getColor(com.hanlink.res.R.color.common_bg));
        tv.setTextSize(20f);
        tv.setTextColor(getContext().getResources().getColor(com.hanlink.res.R.color.xover_pass_spinner_textcolor));

        return convertView;
    }

    @NonNull
    @Override
    public View getView(int position, View convertView, @NonNull ViewGroup parent) {
        if (convertView == null) {
            LayoutInflater inflater = LayoutInflater.from(getContext());
            convertView = inflater.inflate(android.R.layout.simple_spinner_item, parent, false);
        }
        TextView tv = convertView.findViewById(android.R.id.text1);
        tv.setText(getItem(position));
        tv.setTextSize(20f);
		tv.setTextColor(getContext().getResources().getColor(com.hanlink.res.R.color.xover_pass_spinner_textcolor));
        return convertView;
    }
}
